package com.example.emergency;





import java.io.File;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.AdapterView.AdapterContextMenuInfo;

public class EmergencyfirstAid extends Activity {
	Button button1=null;
	Button button2=null;
	Button button3=null;
	Button button4=null;
	TextView tv1=null;
	Activity actv=new Activity();
	RestorePhno rs=new RestorePhno();

    
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button button0=(Button)findViewById(R.id.button0);//to restore emergency phno
        Button button1=(Button)findViewById(R.id.button1);//call to parents
        //Button button2=(Button)findViewById(R.id.button2);//find nearest hosp
        Button button3=(Button)findViewById(R.id.button3);//check fields
       // Button tempbutton=(Button) findViewById(R.id.tempbutton);
      //  Button exitbutton=(Button)findViewById(R.id.exit);
       
     
        //set button sound
        final MediaPlayer mp=MediaPlayer.create(this, R.raw.sound4);
        
        
        tv1=(TextView) findViewById(R.id.tv1);
        
      
        button0.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent i=new Intent(EmergencyfirstAid.this,RestorePhno.class);
				startActivity(i);				
				mp.start();
			}
		});
     
        
        OnClickListener listener=new OnClickListener()
        {
        	public void onClick(View v)
        	{
        		Intent i=new Intent(EmergencyfirstAid.this,RetrievePhno.class);
        		startActivity(i);
        		mp.start();
        	}
        };
        button1.setOnClickListener(listener);
        
       /* tempbutton.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent i=new Intent(EmergencyfirstAid.this,TempActivity.class);
				startActivity(i);				
			}
		});*/
        
        button3.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent i=new Intent(EmergencyfirstAid.this,RetrieveData.class);
				startActivity(i);
				mp.start();
			}
		});
        
       /* button2.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
			//	final Intent intent = new Intent(Intent.ACTION_MAIN, null);
			//	Intent intent = new Intent(this, )
				intent.addCategory(Intent.CATEGORY_LAUNCHER);
				final ComponentName cn = new ComponentName("com.example.googlemaps","com.example.googlemaps.GoogleMapActivity");
				intent.setComponent(cn);
				intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				startActivity( intent);
				mp.start();		
				
			}
		});*/
       /* exitbutton.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
				AlertDialog.Builder builder=new AlertDialog.Builder(EmergencyfirstAid.this);
				builder.setMessage("Do you want to exit");
				builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
					
					@Override
					public void onClick(DialogInterface dialog, int which) {
						// TODO Auto-generated method stub
						EmergencyfirstAid.this.finish();
						
					}
				});
				builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
					
					@Override
					public void onClick(DialogInterface dialog, int which) {
						// TODO Auto-generated method stub
						dialog.cancel();
						
					}
				});
				builder.create();
				builder.show();
			}
		});
        */
        
        
    }
    
    
}